<extend name="Public/base"/>

<block name="body">
	<div class="main-title">
		<h2>网站设置</h2>
	</div>
		<div class="tab-wrap">
		<ul class="tab-nav nav">
		<volist name="Think.config.CONFIG_GROUP_LIST" id="group">
			<?php if($group=='基本'){?>
			<li <eq name="id" value="$key">class="current"</eq>>
				<a href="{:U('?id='.$key)}">{$group}配置</a>
			</li>
			<?php }?>

		</volist>
		</ul>
		<div class="tab-content">
	<form action="{:U('save')}" method="post" class="form-horizontal" enctype="multipart/form-data">
	<volist name="list" id="config">
		<div class="form-item">
			<label class="item-label">{$config.title}<span class="check-tips">（{$config.remark}）</span> </label>
			<div class="controls">
			<switch name="config.type">
			<case value="0">
				<input type="text" class="text input-small" name="config[{$config.name}]" value="{$config.value}">
			</case>
			<case value="1">
				<input type="text" class="text input-large" name="config[{$config.name}]" value="{$config.value}">
			</case>
			<case value="2">
			<label class="textarea input-large">
				<textarea name="config[{$config.name}]">{$config.value}</textarea>
			</label>
			</case>
			<case value="3">
			<label class="textarea input-large">
				<textarea name="config[{$config.name}]">{$config.value}</textarea>
			</label>
			</case>
			<case value="4">
				<select name="config[{$config.name}]">
					<volist name=":parse_config_attr($config['extra'])" id="vo">
						<option value="{$key}" <eq name="config.value" value="$key">selected</eq>>{$vo}</option>
					</volist>
				</select>
			</case>
				<case value="5">
					<style>
						.layui-upload-file{
							display: none!important;
							opacity: .01;
						}
						.layui-btn{
							display: inline-block;
							height: 38px;
							line-height: 38px;
							padding: 0 18px;
							background-color: #009688;
							color: #fff;
							white-space: nowrap;
							text-align: center;
							font-size: 14px;
							border: none;
							border-radius: 2px;
							cursor: pointer;
						}
					</style>
					<script src="__ROOT__/Public/Admin/layui/layui.js"></script>
					<div>
						<input type="hidden" name="config[{$config.name}]" value="{$config.value}" id="{$config.name}_inp">
						<img style="width: 100px;height: 100px;" src="{$config.value}" alt="" id="{$config.name}_img">
						<br/>
						<button type="button" class="layui-btn" id="{$config.name}">
							上传图片
						</button>
					</div>

				</case>
			</switch>
				
			</div>
		</div>
		</volist>
		<script>
			layui.use('upload', function(){
				var upload = layui.upload;
				//执行实例
				var uploadInst = upload.render({
					elem: '#TBD_KF' //绑定元素
					,url: "{:U('File/TBD_upload')}" //上传接口
					,done: function(res){
						//上传完毕回调
						if(res.data!='失败'){
							$('#TBD_KF_inp').val(res.data);
							$('#TBD_KF_img').attr('src',res.data);
						}
					}
					,error: function(){
						//请求异常回调
					}
				});
				var uploadInst = upload.render({
					elem: '#TBD_SK' //绑定元素
					,url: "{:U('File/TBD_upload')}"//上传接口
					,done: function(res){
						//上传完毕回调
						$('#TBD_SK_inp').val(res.data);
						$('#TBD_SK_img').attr('src',res.data);
					}
					,error: function(){
						//请求异常回调
					}
				});
                var uploadInst = upload.render({
					elem: '#LOGO' //绑定元素
					,url: "{:U('File/TBD_upload')}"//上传接口
					,done: function(res){
						//上传完毕回调
						$('#TBD_LOGO_inp').val(res.data);
						$('#TBD_LOGO_img').attr('src',res.data);
					}
					,error: function(){
						//请求异常回调
					}
				});
				var uploadInst = upload.render({
					elem: '#TBD_SK2' //绑定元素
					,url: "{:U('File/TBD_upload')}"//上传接口
					,done: function(res){
						//上传完毕回调
						$('#TBD_SK2_inp').val(res.data);
						$('#TBD_SK2_img').attr('src',res.data);
					}
					,error: function(){
						//请求异常回调
					}
				});
			});
		</script>
		<div class="form-item">
			<label class="item-label"></label>
			<div class="controls">
				<empty name="list"><button type="submit" disabled class="btn submit-btn disabled" target-form="form-horizontal">确 定</button><else/><button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button></empty>
				
				<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
			</div>
		</div>
	</form>
			</div>
	</div>
</block>

<block name="script">

</block>
